// Bachelor of Software Engineering 
// Media Design School 
// Auckland
// New Zealand
// 
// (c) 2005 - 2014 Media Design School 
// 
// File Name : Time.cpp
// Description : Time implementation
// Author : Serge Radinovich
// Mail : srad015@hotmail.com

#include "Time.h"
#include <Windows.h>
#include <MMSystem.h>

Time::Time(void) : dDeltaTime(0), dTimeScale(0), dCurrent(0), dLast(0) 
{
	__int64 _iCountsPerSec = 0;
	bool _bPerfExists = QueryPerformanceFrequency((LARGE_INTEGER*)&_iCountsPerSec) != 0;
	if(_bPerfExists)
	{
		dTimeScale = 1.0 / (double)_iCountsPerSec;
	}
}

Time::~Time(void)
{
}

////////////////////////////
//Returns current real time
///////////////////////////
double Time::CurrentTime()
{
	__int64 time = 0;
	QueryPerformanceCounter((LARGE_INTEGER*)&time);
	double timeInSeconds = (double) (time) * dTimeScale;
	return timeInSeconds;
}